﻿@using Webdiyer.WebControls.Mvc

@model PagedList<WebShop.Contracts.Order>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<div id="dvOrders">
    <table>
        <tr>
            <th>
                OrderID
            </th>
            <th>
                OrderDate
            </th>
            <th>
                RequiredDate
            </th>
            <th>
                ShippedDate
            </th>
            <th>
                Shippers
            </th>
            <th>
                Freight
            </th>
            <th>
                ShipName
            </th>
            <th>
                ShipAddress
            </th>
            <th>
                ShipCity
            </th>
            <th>
                ShipCountry
            </th>
            <th></th>
        </tr>

    @foreach (var item in Model) {
        <tr>
            <td>
                @Html.ActionLink(item.OrderID.ToString(), "Details", "Orders", new { id = item.OrderID }, new { title = "View order details" })
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.OrderDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.RequiredDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ShippedDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Shippers.CompanyName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Freight)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ShipName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ShipAddress)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ShipCity)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ShipCountry)
            </td>
        </tr>
    }

    </table>

    <p>
       @Html.Pager(Model, new PagerOptions() { PageIndexParameterName = "pageIndex", ShowDisabledPagerItems = false, AlwaysShowFirstLastPageNumber = true })
    </p>
</div>